<script language="javascript" type="text/javascript">
  function a(){
  var b=document.getElementsByName("all")[0].checked;
  var obS=document.getElementsByName("id[]");
  for(var i=0;i<obS.length;i++){
    obS[i].checked=b;
  }
}
function aaa(){ 
   var str=""; 
    var blackName = document.getElementsByName("id[]");   
    for(var i = 0; i < blackName.length; i++){   
       if(blackName[i].checked == true){   
          var a = blackName[i].value;
          str +=a+',';
       }   
    } 
    str = str.substring(0,str.length-1);
    //alert(str);
  //document.getElementById("gid").value=str;
     $.get("<?=site_url('user/del')?>",{id:str},function(data){
      //alert(data); return false;
          if(data == 1){
            alert('删除成功');
          }  
      });
} 
</script>
<div class="admin-content">

  <div class="am-cf am-padding">
    <div class="am-fl am-cf"> <strong class="am-text-primary am-text-lg">用户管理</strong>
      /
      <small>users</small>
    </div>
  </div>

  <div class="am-g">
    <div class="am-u-md-6 am-cf">
      <div class="am-fl am-cf">
        <div class="am-btn-toolbar am-fl">
          <div class="am-btn-group am-btn-group-xs">
            <button type="button" class="am-btn am-btn-default" onclick="location.href='<?=site_url('user/create')?>'">
              <span class="am-icon-plus"></span>
              新增
            </button>
            <button type="button" class="am-btn am-btn-default" onclick="aaa()">
              <span class="am-icon-trash-o"></span>
              删除
            </button>
          </div>

        </div>
      </div>
    </div>
    <div class="am-u-md-3 am-cf">
      <div class="am-fr">
        <div class="am-input-group am-input-group-sm">
          <input type="text" class="am-form-field">
          <span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button">搜索</button>
          </span>
        </div>
      </div>
    </div>
  </div>

  <div class="am-g">
    <div class="am-u-sm-12">
        <table class="am-table am-table-striped am-table-hover table-main">
          <thead>
            <tr>
              <th class="table-check">
                <input type="checkbox" onclick="a();" name="all"/>
              </th>
              <th class="table-id">ID</th>
              <th class="table-title">名称</th>
              <th class="table-type">邮箱</th>
              <th class="table-author">权限</th>
              <th class="table-date">创建时间</th>
              <th class="table-set">操作</th>
            </tr>
          </thead>
          <tbody>
            <?php foreach($list as $k => $v):?>
            <tr>
              <td>
                <input type="checkbox" name="id[]" value="<?=$v['id']?>"/>
              </td>
              <td><?=$v['id']?></td>
              <td>
                <a href="<?=site_url('comment/show?cid='.$v['id'])?>" style="<?=$v['group'] == 1 || $v['group'] == 2 ? 'color:blue' : ''?><?=$v['group'] == 4 ? 'color:red' : ''?>"><?=$v['name']?></a>
              </td>
              <td><?=$v['email']?></td>
              <td><?=$v['group_name']?></td>
              <td><?=date('Y-m-d H:i:s',$v['create_time'])?></td>
              <td>
              <div class="am-dropdown" data-am-dropdown="">
                <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>
                <ul class="am-dropdown-content">
                  <li><a href="<?=site_url('user/update?uid='.$v['id'])?>">1. 编辑</a></li>
                  <li><a href="<?=site_url('user/delete?cid='.$v['id'])?>">2. 删除</a></li>
                  <li><a href="<?=site_url('user/show?uid='.$v['id'])?>">3. 详情</a></li>
                  <li><a href="<?=site_url('user/passconf?uid='.$v['id'])?>">4. 密码重置</a></li>
                </ul>
              </div>
            </td>
            </tr>
            <?php endforeach;?>

          </tbody>
        </table>
        <div class="am-cf">
          共 <?=$rows?> 条记录
          <div class="am-fr">

            <ul class="am-pagination">
              <?=$page?>
            </ul>
          </div>
        </div>
        <hr />
        <p>注：用户名为蓝色的为管理员 红色的为未激活会员</p>
    </div>

  </div>
</div>